<template>
	<router-view></router-view>

	<van-tabbar @change="onChange">
		<van-tabbar-item v-for="(item,i) in itemList" :key="i" :icon="item.icon">{{item.title}}</van-tabbar-item>
	</van-tabbar>

</template>

<script setup>
	import { ref } from 'vue';
	import { useRouter } from 'vue-router';
	const router = useRouter()

	const itemList = [
		{ path: '/', title: '首页', icon: 'home-o' },
		{ path: '/todo', title: '待办', icon: 'search' },
		{ path: '/productList', title: '商品', icon: 'gift-o' },
		{ path: '/productList', title: '购物车', icon: 'gift-o' }
	]

	const onChange = (index) => {
		console.log(index)
		router.push(itemList[index].path)
	}
</script>

<style>
</style>